using MediatR;
using Microsoft.AspNetCore.Mvc;
using RBAC.ErrorCode;
using RBAC.Write.Api.Application.Command.ERP.SalesManagement.H;

namespace RBAC.Write.Api.Controllers.ERP
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class DeliveryNoticeDeleteController : ControllerBase
    {
        private readonly IMediator _mediator;

        public DeliveryNoticeDeleteController(IMediator mediator)
        {
            _mediator = mediator;
        }

        /// <summary>
        /// 逻辑删除发货通知单（Delivery_notice.IsDeleted = true）
        /// </summary>
        [HttpPost]
        public Task<APIResult<bool>> Delete([FromBody] DeleteDeliveryNoticeCommand request, CancellationToken cancellationToken)
        {
            return _mediator.Send(request, cancellationToken);
        }

        /// <summary>
        /// 批量逻辑删除发货通知单（含明细表同步逻辑删除）
        /// </summary>
        [HttpPost("BatchDelete")]
        public Task<APIResult<bool>> BatchDelete([FromBody] BatchDeleteDeliveryNoticeCommand request, CancellationToken cancellationToken)
        {
            return _mediator.Send(request, cancellationToken);
        }
    }
}
